package com.qf.air;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.annotation.Bean;

/**
 * @author 10537
 * @version V1.0
 * @Date 2021/11/11 16:17
 */
@SpringBootApplication
@EnableZuulProxy
public class ZuulStartedApp {
    public static void main(String[] args) {
        SpringApplication.run(ZuulStartedApp.class,args);
    }

    @Bean
    public PatternServiceRouteMapper serviceRouteMapper() {
        // 服务名： 服务名-版本号
        // 默认路由: /版本号/服务名
        return new PatternServiceRouteMapper(
                "(?<name>^.+)-(?<version>v.+$)",
                "${version}/${name}");

    }
}
